package com.dehui.traders.utils;

import android.content.Context;
import android.text.TextUtils;

import com.dehui.traders.config.Preferences;
import com.dehui.traders.R;
import com.dehui.traders.ui.login.LoginActivity;

import me.goldze.mvvmhabit.utils.ToastUtils;

public class UserHelp{

    public static boolean getIsLogin(Context context){
        String token = Preferences.getToken();
        if(TextUtils.isEmpty(token)){
            LoginActivity.start(context);
            ToastUtils.showShort(R.string.please_login_first);
            return false;
        }
        return true;
    }

    public static String getUserId(){
        return Preferences.getUserId();
    }

    public static boolean isLogin(){
        String token = Preferences.getToken();
        if(TextUtils.isEmpty(token)){
            return false;
        }
        return true;
    }

}
